#include <stdio.h>

int main(void)
{
    int num[5][5];

    for (int i = 0; i < 5; i++)
    {
        printf("Enter row %d: ", i+1);
        for (int k = 0; k < 5; k++)
            scanf(" %d", &num[i][k]);
    }

    int row_sum[5], col_sum[5];
    
    for (int j = 0; j < 5; j++)
    {
        row_sum[j] = num[j][0] + num[j][1] + num[j][2] + num[j][3] + num[j][4];
        col_sum[j] = num[0][j] + num[1][j] + num[2][j] + num[3][j] + num[4][j];
    }

    printf("\nRow totals: ");
    for (int l = 0; l < 5; l++)
        printf(" %d", row_sum[l]);

    printf("\nColumn totals: ");
    for (int m = 0; m < 5; m++)
        printf(" %d", col_sum[m]);

    return 0;
}